import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router';
import Find from '@/views/Find.vue';
import My from '@/views/My.vue';
import Friend from '@/views/Friend.vue';
import NotFound from '@/views/404.vue';

const routes = [
  { path: '/', redirect: '/home' },
  { path: '/home', component: () => import('@/views/HomeView.vue') },
  { path: '/search/:key?', name:'SearchView', component: () => import('@/views/SearchView.vue') },
  { path: '/find', component: () => import('@/views/Find.vue') },
  { path: '/my', component: () => import('@/views/My.vue') },
  { path: '/friend', component: () => import('@/views/Friend.vue') },
  { path: '/:pathMatch(.*)*', component: () => NotFound },
];

const router = createRouter({
  history: createWebHistory(),
  routes,
});

export default router;
